package com.ruoyi.dataPanel.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.dataPanel.domain.Order;
import com.ruoyi.dataPanel.domain.OrderReturn;
import com.ruoyi.dataPanel.service.DataPanelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dataPanel")
public class DataPanelController extends BaseController {
    @Autowired
    DataPanelService dataPanelService;


    @GetMapping("/list")
    public TableDataInfo dataInfoList(String SelectedDates, String SelectedCategories,String years,
                                      String months,
                                      String weeks  ) {
        List<Order> list = dataPanelService.dataPanelList(SelectedCategories, SelectedDates,years,months,weeks);
        System.out.println("分类：" + SelectedCategories + "::::" + "日期：" + SelectedDates);
        return getDataTable(list);
    }

    @GetMapping("/handoffList")
    public TableDataInfo handoffList(String SelectedDates, String SelectedCategories,String years,
                                     String months,
                                     String weeks  ) {
        System.out.println("更新日期：" + SelectedDates + "::::" + "更新分类：" + SelectedCategories);
        List<Order> list = dataPanelService.handoffData(SelectedDates, SelectedCategories,years,months,weeks);
        return getDataTable(list);
    }
    //订单数据
    @GetMapping("/orderDataHandoff")
    public TableDataInfo orderDataHandoff(String SelectedDates, String SelectedCategories, String year, String months, String weeks) {
        System.out.println("订单日期：" + SelectedDates + "::::" + "订单分类：" + SelectedCategories);
        System.out.println("年：" + year + "::::" + "月：" + months +"::::"+"周"+weeks);
        List<Order> list = dataPanelService.orderDataHandoff(SelectedDates, SelectedCategories,year,months,weeks);
        return getDataTable(list);
    }
    //退款数据
    @GetMapping("/orderReturnsDataHandoff")
    public TableDataInfo orderReturnsDataHandoff(String SelectedDates, String SelectedCategories) {
        System.out.println("退款日期：" + SelectedDates + "::::" + "退款分类：" + SelectedCategories);
        List<OrderReturn> list = dataPanelService.orderReturnsList(SelectedDates, SelectedCategories);
        return getDataTable(list);
    }
    //成交订单数数据数据
    @GetMapping("/orderDealList")
    public TableDataInfo orderDealList(String SelectedDates, String SelectedCategories) {
        System.out.println("成交订单日期：" + SelectedDates + "::::" + "成交订单分类：" + SelectedCategories);
        List<Order> list = dataPanelService.orderDealList(SelectedDates, SelectedCategories);
        return getDataTable(list);
    }
}
